package ysansi

import "fmt"

type Color int

type FrontColor = Color

const (
	FrontBlack FrontColor = iota + 30
	FrontRed
	FrontGreen
	FrontYellow
	FrontBlue
	FrontPurple
	FrontDarkGreen
	FrontWhite
)
const (
	FrontLightBlack FrontColor = iota + 90
	FrontLightRed
	FrontLightGreen
	FrontLightYellow
	FrontLightBlue
	FrontLightPurple
	FrontLightDarkGreen
	FrontLightWhite
)

type BackColor = Color

const (
	BackBlack BackColor = iota + 40
	BackRed
	BackGreen
	BackYellow
	BackBlue
	BackPurple
	BackDarkGreen
	BackWhite
)
const (
	BackLightBlack BackColor = iota + 100
	BackLightRed
	BackLightGreen
	BackLightYellow
	BackLightBlue
	BackLightPurple
	BackLightDarkGreen
	BackLightWhite
)

func BlackStr(str string) string {
	return ChangeOneColor(str, FrontBlack)
}
func RedStr(str string) string {
	return ChangeOneColor(str, FrontRed)
}
func GreenStr(str string) string {
	return ChangeOneColor(str, FrontGreen)
}
func YellowStr(str string) string {
	return ChangeOneColor(str, FrontYellow)
}
func BlueStr(str string) string {
	return ChangeOneColor(str, FrontBlue)
}
func PurpleStr(str string) string {
	return ChangeOneColor(str, FrontPurple)
}
func DarkGreenStr(str string) string {
	return ChangeOneColor(str, FrontDarkGreen)
}
func WhiteStr(str string) string {
	return ChangeOneColor(str, FrontWhite)
}

func LightBlackStr(str string) string {
	return ChangeOneColor(str, FrontLightBlack)
}
func LightRedStr(str string) string {
	return ChangeOneColor(str, FrontLightRed)
}
func LightGreenStr(str string) string {
	return ChangeOneColor(str, FrontLightGreen)
}
func LightYellowStr(str string) string {
	return ChangeOneColor(str, FrontLightYellow)
}
func LightBlueStr(str string) string {
	return ChangeOneColor(str, FrontLightBlue)
}
func LightPurpleStr(str string) string {
	return ChangeOneColor(str, FrontLightPurple)
}
func LightDarkGreenStr(str string) string {
	return ChangeOneColor(str, FrontLightDarkGreen)
}
func LightWhiteStr(str string) string {
	return ChangeOneColor(str, FrontLightWhite)
}

func ChangeOneColor(str string, color Color) string {
	return fmt.Sprintf("\033[%dm%s\033[0m", color, str)
}
func ChangeTowColor(str string, front FrontColor, back BackColor) string {
	return fmt.Sprintf("\033[%d,%dm%s\033[0m", front, back, str)
}
